import yaml


def read_data(file_path):
    with open(file_path) as f:
        res = yaml.safe_load(f)
    return res


# 带测试用例编号key一起读取！
# 参数file_name:你要读取的yaml文件的路径
# 参数Key：yaml文件中你要读取那个部分的Key
# 返回值：List[Dict]
def read_cesiData(file_name, key):
    with open(file_name, "r") as f:
        data = yaml.load(f, Loader=yaml.FullLoader)[key]
        ret = list()
        for k in data.keys():
            v = data[k]
            v["key"] = k
            ret.append(v)
        return ret
